import { makeOptionsRule, makeRequiredRule } from '../../../utils/index'

const label = '多选'
const name = 'checkbox'
let i = 1
const uniqueId = () => `${name}${i++}`
export default {
  label,
  name,
  rule() {
    return {
      type: name,
      field: uniqueId(),
      title: label,
      info: '',
      effect: {
        fetch: ''
      },
      props: {},
      options: [
        { value: '1', label: '选项1' },
        { value: '2', label: '选项2' }
      ]
    }
  },
  props() {
    return [
      makeRequiredRule(),
      makeOptionsRule('options'),
      {
        type: 'inputNumber',
        field: 'min',
        title: '可被勾选的 checkbox 的最小数量'
      },
      {
        type: 'inputNumber',
        field: 'max',
        title: '可被勾选的 checkbox 的最大数量'
      }
    ]
  }
}
